<style>
  :host {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    width: 32px;
  }

  #container {
    align-items: center;
    aspect-ratio: 1 / 1;
    border-radius: var(--cr-realbox-icon-border-radius, 8px);
    display: flex;
    justify-content: center;
    overflow: hidden;
    position: relative;
    width: 100%;
  }

  /* Entities may feature a dominant color background until image loads. */
  :host-context(cr-realbox-match[has-image]) #container {
    background-color: var(--cr-realbox-icon-container-bg-color,
        var(--container-bg-color));
  }

  /* Calculator answer and suggestion answer icons feature a blue background. */
  :host-context(cr-realbox-match[is-rich-suggestion]:not([has-image])) #container {
    background-color: var(--google-blue-600);
    border-radius: 50%;
    height: 24px;
    width: 24px;
  }

  #image {
    display: none;
    height: 100%;
    object-fit: contain;
    width: 100%;
  }

  :host-context(cr-realbox-match[has-image]) #image {
    display: initial;
  }

  :host([is-answer]) #image {
    max-height: 24px;
    max-width: 24px;
  }

  #imageOverlay {
    display: none;
  }

  /* Put a black scrim over the image for entity suggestions in case the images
   * have a background color that matches the background color of the dropdown.
   * This makes it clearer where the boundary of the image is. */
  :host-context(cr-realbox-match[is-entity-suggestion][has-image])
      #imageOverlay {
    background: black;
    display: block;
    inset: 0;
    opacity: .05;
    position: absolute;
  }

  #icon {
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 16px;
    background-color: var(--color-realbox-search-icon-background);
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 16px;
    height: 24px;
    width: 24px;
  }

  :host-context(cr-realbox-match[has-image]) #icon {
    display: none;
  }

  :host-context(cr-realbox-match[is-rich-suggestion]) #icon {
    background-color: white;
  }

  :host([in-searchbox][background-image*='//resources/cr_components/omnibox/icons/google_g.svg']) #icon {
    background-size: 24px;
  }

  :host([in-searchbox][mask-image*='//resources/images/icon_search.svg']) #icon {
    -webkit-mask-size: 20px;  /* Loupe in realbox is larger than in matches. */
  }
</style>
<div id="container" style="--container-bg-color:
    [[containerBgColor_(match.imageDominantColor, imageLoading_)]];">
  <img id="image" src="[[imageSrc_]]" on-load="onImageLoad_"></img>
  <div id="imageOverlay"></div>
  <!--Note: Do not remove the '$' in '$=' below, otherwise the 'style' attribute
      is erroneously removed by the HTML minifier. -->
  <div id="icon" style$="[[iconStyle_]]"></div>
</div>
